760b62a22186e2a7d5fb40b62058d33801d63a44,src/me/ryanhamshire/griefprevention/event/PlayerEventHandler.java,PlayerEventHandler,onPlayerInteractEntity,#InteractEntityEvent#Player#,1127

Before Change


            return;
        }

        Claim claim = this.dataStore.getClaimAt(targetEntity.getLocation(), false, null);
        PlayerData playerData = this.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());

        // if entity has an owner, apply special rules
        IMixinEntity spongeEntity = (IMixinEntity) targetEntity;
        Optional<User> owner = spongeEntity.getTrackedPlayer(NbtDataUtil.SPONGE_ENTITY_CREATOR);
        if (owner.isPresent()) {
            UUID ownerID = owner.get().getUniqueId();

            // if the player interacting is the owner or an admin in ignore claims mode, always allow
            if (player.getUniqueId().equals(ownerID) || playerData.ignoreClaims) {
                // if giving away pet, do that instead
                if (playerData.petGiveawayRecipient != null) {
                    SpongeEntityType spongeEntityType = ((SpongeEntityType) spongeEntity.getType());
                    if (spongeEntityType != null && !spongeEntityType.getModId().equalsIgnoreCase("minecraft")) {
                        GriefPrevention.sendMessage(player, TextMode.Err, Messages.PetGiveawayInvalid, spongeEntity.getType().getId());
                        playerData.petGiveawayRecipient = null;
                        GPTimings.PLAYER_INTERACT_ENTITY_EVENT.stopTimingIfSync();
                        return;
                    }
                    spongeEntity.setCreator(playerData.petGiveawayRecipient.getUniqueId());
                    if (targetEntity instanceof EntityTameable) {
                        EntityTameable tameable = (EntityTameable) targetEntity;
                        tameable.setOwnerId(playerData.petGiveawayRecipient.getUniqueId());
                    }
                    playerData.petGiveawayRecipient = null;
                    GriefPrevention.sendMessage(player, TextMode.Success, Messages.PetGiveawayConfirmation);
                    GriefPrevention.addEventLogEntry(event, "Pet giveaway.");
                    event.setCancelled(true);
                }
                GPTimings.PLAYER_INTERACT_ENTITY_EVENT.stopTimingIfSync();
                return;
            }
        }

        if (playerData.ignoreClaims) {
            GPTimings.PLAYER_INTERACT_ENTITY_EVENT.stopTimingIfSync();
            return;
        }

        if (event instanceof InteractEntityEvent.Secondary) {
            if (GPPermissionHandler.getClaimPermission(claim, GPPermissions.INTERACT_ENTITY_SECONDARY, player, targetEntity, player) == Tristate.TRUE) {
                GPTimings.PLAYER_INTERACT_ENTITY_EVENT.stopTimingIfSync();
                return;
            }
        } else {
            if (GPPermissionHandler.getClaimPermission(claim, GPPermissions.INTERACT_ENTITY_PRIMARY, player, targetEntity, player) == Tristate.TRUE) {
                GPTimings.PLAYER_INTERACT_ENTITY_EVENT.stopTimingIfSync();
                return;
            }
        }
        String denyReason = claim.allowAccess(player, targetEntity.getLocation());
        if (denyReason != null) {
            GriefPrevention.addEventLogEntry(event, denyReason);
            GriefPrevention.sendMessage(player, Text.of(TextMode.Err, denyReason));

After Change


            return;
        }

        Location<World> location = targetEntity.getLocation();
        Claim claim = this.dataStore.getClaimAt(location, false, null);
        PlayerData playerData = this.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());